using Andromeda.Global.Business.DataObject;
using ForgeIt.Dal.dbo;
using System;

using System.Collections.Generic;
using System.Linq;
using Andromeda.Global.Data;

namespace ForgeIt.Business.Stub
{
	public abstract class AppUserStub : DataObjectModelBase
	{
		#region private fields


		private DBAppUser foDBAppUser;

        private Entity localIdEntity;

        private Application localIdApplication;


		#endregion private fields
    
		#region public constructors

		protected AppUserStub()
			: this(new DBAppUser())
		{
		}

        protected AppUserStub(Entity foIdEntity, Application foIdApplication)
          :this()
        {
            SetIdEntity(foIdEntity);
            SetIdApplication(foIdApplication);
        }

        protected AppUserStub(Entity foIdEntity)
          :this()
        {
            SetIdEntity(foIdEntity);
        }

        protected AppUserStub(Application foIdApplication)
          :this()
        {
            SetIdApplication(foIdApplication);
        }

		#endregion public constructors
    

		#region internal constructors

		internal AppUserStub(DBAppUser foDBAppUser)
		{

			this.foDBAppUser = foDBAppUser;

		}

		#endregion internal constructors
  

		#region protected datasource properties
		

		internal DBAppUser DB_DBAppUser
		{
			get { return foDBAppUser ?? (foDBAppUser = new DBAppUser()); }
		}

		
		public override DataConnectorCollection DataObjects
		{
			get
			{
				return new DataConnectorCollection { foDBAppUser } ;
			}
		}

		

		/// 
		///
		/// 
		public int IdAppUser
		{
			get { return DB_DBAppUser.IdAppUser; }

		}

		/// 
		///
		/// 
		public int IdEntity
		{
			get { return DB_DBAppUser.IdEntity; }

			set { DB_DBAppUser.IdEntity = value; }

		}

		/// 
		///
		/// 
		public int IdApplication
		{
			get { return DB_DBAppUser.IdApplication; }

			set { DB_DBAppUser.IdApplication = value; }

		}

		/// 
		///
		/// 
		public string Username
		{
			get { return DB_DBAppUser.Username; }

			set { DB_DBAppUser.Username = value; }

		}

		/// 
		///
		/// 
		public string Pwd
		{
			get { return DB_DBAppUser.Pwd; }

			set { DB_DBAppUser.Pwd = value; }

		}

		#endregion protected datasource properties
    
		#region protected datasource foreign key properties
    

		///<summary>
		/// Getter method for obtainin a foreign key <see cref="Entity"/> object related to this object
		///</summary>
		public virtual Entity GetIdEntity()
		{
          return localIdEntity ?? (localIdEntity = new Entity(foDBAppUser.GetFK_IdEntity()));
		}
    

  		///<summary>
  		/// Setter method for linking this object to a foreign key object
  		///</summary>
  		///<param name="item">The <see cref="Entity"/> object to which we want to link our IdEntity</param>
  		public virtual void SetIdEntity(Entity item)
        {
          foDBAppUser.SetFK_IdEntity(item.DB_DBEntity);
          localIdEntity = new Entity(foDBAppUser.GetFK_IdEntity());
        }

		///<summary>
		/// Getter method for obtainin a foreign key <see cref="Application"/> object related to this object
		///</summary>
		public virtual Application GetIdApplication()
		{
          return localIdApplication ?? (localIdApplication = new Application(foDBAppUser.GetFK_IdApplication()));
		}
    

  		///<summary>
  		/// Setter method for linking this object to a foreign key object
  		///</summary>
  		///<param name="item">The <see cref="Application"/> object to which we want to link our IdApplication</param>
  		public virtual void SetIdApplication(Application item)
        {
          foDBAppUser.SetFK_IdApplication(item.DB_DBApplication);
          localIdApplication = new Application(foDBAppUser.GetFK_IdApplication());
        }

  
		#endregion protected datasource foreign key properties
    
		#region protected datasource external key properties
    

  
		#endregion protected datasource external key properties
    
		#region properties
    

		#endregion properties
    
		#region methods methods

		#endregion methods

        #region Static Factories

        public static AppUser GetAppUser(int foIdAppUser)
        {
          return new AppUser(DBAppUser.GetEntity(foIdAppUser));
        }
  
        public static IEnumerable<AppUser> ListAppUser()
        {
            return (from DBAppUser entity in DBAppUser.ListEntity() select new AppUser(entity));
        }
        
  
        public static IEnumerable<AppUser> ListAppUser(object foIdAppUser, object foIdEntity, object foIdApplication, object foUsername, object foPwd)
        {
            return (from DBAppUser entity in DBAppUser.ListEntity(foIdAppUser, foIdEntity, foIdApplication, foUsername, foPwd) select new AppUser(entity));
        }
        
        #endregion Static List Methods

	
  }
}